/*********************************************************************\
*
*                  (c) lkc
*                  All Rights Reserved. lkc Confidential
*
\*********************************************************************/
/*********************************************************************\
*   Title                      :
*
*   Module Description         :
*
*   Author                     : lkc
*
*   Created                    : 2018-8-15
*
\*********************************************************************/

#include "FocusControl.h"
#include "ProtocolMCU.h"


FocusControl focusCtl;

FocusControl::FocusControl()
{
#ifdef MCU_COMM_TYPE_IS_QT
    connect(this,&FocusControl::IncFocusSignal,&ProtocolMCU::GetInstance(),static_cast<void(ProtocolMCU::*)(const unsigned char)>(&ProtocolMCU::IncFocus));
    connect(this,&FocusControl::DecFocusSignal,&ProtocolMCU::GetInstance(),static_cast<void(ProtocolMCU::*)(const unsigned char)>(&ProtocolMCU::DecFocus));
    connect(this,&FocusControl::SetFocusSignal,&ProtocolMCU::GetInstance(),static_cast<void(ProtocolMCU::*)(const unsigned char)>(&ProtocolMCU::SetFocus));
    connect(this,&FocusControl::GetFocusCommandSignal,&ProtocolMCU::GetInstance(),&ProtocolMCU::GetFocusCommand);
    connect(this,&FocusControl::SetWorkModeSignal,&ProtocolMCU::GetInstance(),&ProtocolMCU::SetWorkMode);
    connect(this,&FocusControl::MotoSelfCheckSignal,&ProtocolMCU::GetInstance(),static_cast<void(ProtocolMCU::*)()>(&ProtocolMCU::MotoSelfCheck));
#endif//#ifdef MCU_COMM_TYPE_IS_QT
}

void FocusControl::IncFocus(const unsigned char step)
{
#ifdef MCU_COMM_TYPE_IS_QT
    emit IncFocusSignal(step);
#else
    ProtocolMCU::GetInstance().IncFocus(step);
#endif//#ifdef MCU_COMM_TYPE_IS_QT
}

void FocusControl::DecFocus(const unsigned char step)
{
#ifdef MCU_COMM_TYPE_IS_QT
    emit DecFocusSignal(step);
#else
    ProtocolMCU::GetInstance().DecFocus(step);
#endif//#ifdef MCU_COMM_TYPE_IS_QT
}

void FocusControl::SetFocus(const unsigned char value)
{
#ifdef MCU_COMM_TYPE_IS_QT
    emit SetFocusSignal(value);
#else
    ProtocolMCU::GetInstance().SetFocus(step);
#endif//#ifdef MCU_COMM_TYPE_IS_QT
}

void FocusControl::GetFocusCommand()
{
#ifdef MCU_COMM_TYPE_IS_QT
    emit GetFocusCommandSignal();
#else
    ProtocolMCU::GetInstance().GetFocusCommand(step);
#endif//#ifdef MCU_COMM_TYPE_IS_QT
}

void FocusControl::SetWorkMode(bool mode)
{
#ifdef MCU_COMM_TYPE_IS_QT
    emit SetWorkModeSignal(mode);
#else
    ProtocolMCU::GetInstance().SetWorkMode(mode);
#endif//#ifdef MCU_COMM_TYPE_IS_QT
}

void FocusControl::MotoSelfCheck()
{
#ifdef MCU_COMM_TYPE_IS_QT
    emit MotoSelfCheckSignal();
#else
    ProtocolMCU::GetInstance().MotoSelfCheck();
#endif//#ifdef MCU_COMM_TYPE_IS_QT
}

unsigned char FocusControl::GetFocus()
{
    return ProtocolMCU::GetInstance().GetFocus();
}

float FocusControl::GetViewField()
{
    return ProtocolMCU::GetInstance().GetViewField();
}



/********************************************************************\
 *
 * REVISION RECORDS
 *
\*********************************************************************/
/*********************************************************************/
/*
 *
 *
 *
\*********************************************************************/
/*------------------------------The End------------------------------*/
